home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / BuildingBlocks / GrafPortSaver.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  1000 b   |  47 lines  |  [TEXT/R*ch]

  1.  /*
  2.     File:        GrafPortSaver.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __QUICKDRAW__
  15. #include "QuickDraw.h"
  16. #endif
  17.  
  18. /***********************************|****************************************/
  19.  
  20. class CGrafPortSaver
  21. {
  22. public:                                CGrafPortSaver ( GrafPtr newPort );
  23.                                     ~CGrafPortSaver ( );
  24.                                     
  25. protected:
  26.     GrafPtr                            fSavedGrafPort;
  27. };
  28.  
  29. /***********************************|****************************************/
  30.  
  31. inline CGrafPortSaver::CGrafPortSaver ( GrafPtr newPort )
  32. {
  33.     GetPort ( & fSavedGrafPort );
  34.     if ( newPort )
  35.         SetPort ( newPort );
  36. }
  37.  
  38. /***********************************|****************************************/
  39.  
  40. inline CGrafPortSaver::~CGrafPortSaver ( )
  41. {
  42.     if ( fSavedGrafPort )
  43.         SetPort ( fSavedGrafPort );
  44. }
  45.  
  46. /***********************************|****************************************/
  47.